import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:miaowu/app/router/ext_get_navigation.dart';

import '../router/app_router.dart';
import 'webview_page.dart';

class GlobalWebPage extends StatefulWidget {
  const GlobalWebPage({super.key});

  @override
  State<GlobalWebPage> createState() => _GlobalWebPageState();

  //启动当前页面
  static void startInstance(
    String title,
    String url, {
    bool isShowAppBar = true,
  }) {
    return Get.pushPage(CommonRouter.web,
        arguments: {'title': title, 'initialUrl': Uri.encodeFull(url), 'isShowAppBar': isShowAppBar});
  }
}

class _GlobalWebPageState extends State<GlobalWebPage> {
  @override
  Widget build(BuildContext context) {
    bool isShowAppBar = Get.arguments['isShowAppBar'];
    String initialUrl = Get.arguments['initialUrl'];
    String title = Get.arguments['title'];
    return WebViewPage(arguments: WebArguments(initialUrl: initialUrl, showAppbar: isShowAppBar, title: title));
  }
}
